package org.example.service;

import org.example.entity.Post;
import org.example.entity.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;
// Feign远程调用客户端
@FeignClient(value = "myserviceProvider") //需要访问的远程微服务应用名称
public interface PostService {
    //发送远程访问请求
    @PostMapping(value = "/posts/getAllPosts")
    public Response getAllPosts(@RequestParam  Integer page, @RequestParam  String classification,@RequestParam Integer posterId) throws Exception;
    //@PathVariable表示以Restful风格方式时 ，拼接到路径中的参数
    //@RequestParam表示访问远程微服务 Controller需要传递的参数

    @PostMapping(value = {"/posts/getPostDetail"})
    public Response getPostDetail( @RequestParam Integer postID) throws  Exception;
    @PostMapping(value = {"/posts/starPost"})
    public Response starPost( @RequestParam Integer postID) throws  Exception;

    @PostMapping(value = {"/posts/updatePost"})
    public Response updatePost(@RequestBody Post post) throws  Exception;

    @PostMapping(value = {"/posts/addPost"})
    public Response addPost(@RequestBody Post post) throws  Exception;
}
